# -*- coding:utf-8 -*-
from django.db import models
from django import forms

class ExamPaperForm(forms.Form):
	subjects = (('高等数学','高等数学'),('高等代数','高等代数'),('C/C++','C/C++'),('英语','英语'),('思政课','思政课'),('问卷调查','问卷调查'))
	coursename = forms.ChoiceField(required=True,
								choices = subjects,
								error_messages={'required':'课程名称不能为空'})
	examname = forms.CharField(required=True,
							max_length = 100,
							error_messages={'required':'试卷名称不能为空',
											'max_length':'试卷名称最多100位'})
	examtime = forms.IntegerField(required=True,
							min_value = 1,
							error_messages={'required':'Examtime is required.','min_value':'考试时间须大于0'})
	problemnum = forms.IntegerField(required=True,
							min_value = 1,
							error_messages={'required':'ProblemNum is required.','min_value':'题量须大于0'})
	totalscore = forms.IntegerField(required=True,
							min_value = 1,
							error_messages={'required':'总分不能为空','min_value':'总分须大于0'})
	note = forms.CharField(required=False,
							max_length = 200,
							error_messages={'max_length':'备注最多200位'})

class SingleProblemForm(forms.Form):
	singletitle = forms.CharField(required=True,
	 							widget = forms.Textarea,
	 							max_length = 2000,
	 							error_messages={'required':'题目不能为空','max_length':'题目长度最多2000位'})
	optionA = forms.CharField(required = True,
	 						max_length = 500,
	 						error_messages={'required':'选项不能为空','max_length':'选项长度最多500位'})
	optionB = forms.CharField(required = True,
	 						max_length = 500,
							error_messages={'required':'选项不能为空','max_length':'选项长度最多500位'})
	optionC = forms.CharField(required = True,
							max_length = 500,
							error_messages={'required':'选项不能为空','max_length':'选项长度最多500位'})
	optionD = forms.CharField(required = True,
							max_length = 500,
							error_messages={'required':'选项不能为空','max_length':'选项长度最多500位'})
	SingleChoice = (('A', 'A'), ('B', 'B'),('C','C'),('D','D'))
	singleanswer = forms.ChoiceField(required = True,
							choices = SingleChoice,
							error_messages={'required':'答案不能为空'})
	analysis = forms.CharField(required=True,
	 						widget = forms.Textarea,
	 						max_length = 4000,
	 						error_messages={'required':'解析不能为空','max_length':'解析长度最多4000位'})
	weight = forms.IntegerField(required = True,
							min_value = 1,
							error_messages = {'required':'分值不能为空','min_value':'分值须大于0'}
							)
	note = forms.CharField(required=False,
							max_length = 200,
							error_messages={'max_length':'备注最多200位'})

class JudgementProblemForm(forms.Form):
	judgementtitle = forms.CharField(required=True,
	 							widget = forms.Textarea,
	 							max_length = 2000,
	 							error_messages={'required':'题目不能为空','max_length':'题目长度最多2000位'})
	JudgementChoice = (('A','True' ), ('B','False'))
	judgementanswer = forms.ChoiceField(required = True,
							choices = JudgementChoice,
							error_messages={'required':'答案不能为空'})
	analysis = forms.CharField(required=True,
	 						widget = forms.Textarea,
	 						max_length = 4000,
	 						error_messages={'required':'解析不能为空','max_length':'解析长度最多4000位'})
	weight = forms.IntegerField(required = True,
							min_value = 1,
							error_messages = {'required':'分值不能为空','min_value':'分值须大于0'}
							)
	note = forms.CharField(required=False,
							max_length = 200,
							error_messages={'max_length':'备注最多200位'})